//
//  CaStudent+rn.m
//  ObjcGoNew
//
//  Created by 邢伟新 on 2021/4/29.
//

#import "CaStudent+rn.h"
#import <objc/runtime.h>
#import <objc/message.h>

@implementation CaStudent (rn)

//-(void)play{
//    NSLog(@"-------%s",__func__);
//}


static NSString *_name;
-(void)setName:(NSString *)name
{
    _name = name;
}
-(NSString *)name
{
    return _name;
}




-(void)setAge:(NSString *)age{
    
    //参数一:给那个对象添加属性
    //参数二:属性名
    //参数三:关联的值,也就是set方法存入值给属性去保存
    //策略
    objc_setAssociatedObject(self, @"age",age, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}


-(NSString *)age
{
    return objc_getAssociatedObject(self, @"age");
}




@end
